package uniandes.cupi2.helpDesk.interfaz;

import javax.swing.JPanel;
import java.awt.Frame;
import java.awt.BorderLayout;
import javax.swing.JDialog;
import javax.swing.JLabel;
import java.awt.Rectangle;
import java.awt.Dimension;
import javax.swing.JTextArea;
import javax.swing.JButton;

import uniandes.cupi2.helpDesk.mundo.ITicket;
import uniandes.cupi2.helpDesk.mundo.IUsuario;

public class DialogoReabrir extends JDialog {

	private static final long serialVersionUID = 1L;

	private JPanel jContentPane = null;

	private JLabel lblDescripcion = null;

	private JTextArea txtDescripcion = null;
	
	private InterfazHelpDesk principal;
	
	private ITicket ticket;

	private JButton btnReabrir = null;

	/**
	 * @param owner
	 */
	public DialogoReabrir(Frame owner, InterfazHelpDesk nPrincipal, ITicket nTicket)
	{
		super(owner);
		principal = nPrincipal;
		ticket = nTicket;
		initialize();
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		this.setSize(286, 293);
		this.setContentPane(getJContentPane());
	}

	/**
	 * This method initializes jContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJContentPane() {
		if (jContentPane == null) {
			lblDescripcion = new JLabel();
			lblDescripcion.setBounds(new Rectangle(15, 15, 113, 26));
			lblDescripcion.setText("Descripcion");
			jContentPane = new JPanel();
			jContentPane.setLayout(null);
			jContentPane.add(lblDescripcion, null);
			jContentPane.add(getTxtDescripcion(), null);
			jContentPane.add(getBtnReabrir(), null);
		}
		return jContentPane;
	}

	/**
	 * This method initializes txtDescripcion	
	 * 	
	 * @return javax.swing.JTextArea	
	 */
	private JTextArea getTxtDescripcion() {
		if (txtDescripcion == null) {
			txtDescripcion = new JTextArea();
			txtDescripcion.setBounds(new Rectangle(19, 63, 236, 127));
		}
		return txtDescripcion;
	}

	/**
	 * This method initializes btnReabrir	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getBtnReabrir() {
		if (btnReabrir == null) {
			btnReabrir = new JButton();
			btnReabrir.setBounds(new Rectangle(21, 211, 90, 27));
			btnReabrir.setText("Reabrir");
			btnReabrir.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) 
				{
					String  mensaje = txtDescripcion.getText();
					IUsuario usuario = principal.darLogin();
					principal.ReabrirTicket(ticket, mensaje,usuario );
					dispose();
				}
			});
		}
		return btnReabrir;
	}

}  //  @jve:decl-index=0:visual-constraint="10,10"
